<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
<title>public</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

<!-- Basic Styles -->
<link rel="stylesheet" href="${ctx}/static/bootstrap/css/font-awesome.min.css">
<link rel="stylesheet" href="${ctx}/static/css/layout.css">
<link rel="stylesheet" href="${ctx}/static/css/groups.css">
<link rel="stylesheet" href="${ctx}/static/css/number.css">
<link rel="stylesheet" href="${ctx}/static/css/layer/layer.css">

<script type="text/javascript" src="${ctx}/static/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="${ctx}/static/js/sideBar.js"></script>
<script src="${ctx}/static/js/layer/layer.js"></script> 
<script src="${ctx}/static/js/layer/layer-common.js"></script> 
<!--<script type="text/javascript" src="../js/menuDown.js"></script>-->

</head>
<body>
<!--heaer begin-->
<header class="header dropdown">
    <img src="${ctx}/static/images/public/logo.png">
    <div class="pull-right">
        <!--必须引用<a></a> 和data-toggle="dropdown"属性和class="dropdown-menu"才能调用-->
        <a class="qh-user cursor" id="dropdownMenu1" data-toggle="dropdown">
            <i class="fa fa-user"></i> <span> 超级管理员 </span>
            <i class="fa fa-chevron-down"></i>
        </a>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
            <li class="dropdown-li" role="presentation"><a role="menuitem" tabindex="-1" href="#"><i class="fa fa-user mr5"></i>个人中心</a></li>
            <li class="dropdown-li" role="presentation"><a role="menuitem" tabindex="-1" href="#"><i class="fa fa-sign-out mr5"></i>退出</a></li>
        </ul>
    </div>
</header>
<!--header end-->
<div class="warp">
<!--sideBar begin-->
  <div id="sideBar">
    <div class="sideBar"> <a class="sideBar-memu"><i class="fa fa-navicon"></i></a>
        <ul class="sideBar-list">
                <li>
                    <a href="#"><i class="fa fa-home"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">主页</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-file-text-o"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">发文流程</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-archive"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">草稿箱</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-retweet"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">出入库管理</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-shield"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">安全追溯</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-tty"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">储备粮油管理</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-list-alt"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">仓内粮情</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-lock"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">库区安全</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-building"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">市场粮情录入</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-video-camera"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">市场粮情监控</span></span>
                    </a>
                </li>
                <li>
                    <a href="#"><i class="fa fa-bar-chart-o"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">市场粮情分析</span></span>
                    </a>
                </li>
                <li class="houbu" style="display: none;">
                    <a href="#"><i class="fa fa-shirtsinbulk"></i>
                        <span class="tooltips"><i class="arrow_left_ico"></i><span class="tooltips-con">应急指挥</span></span>
                    </a>
                </li>
           </ul>
    </div>
    <div class="sideBar-open"> <a class="sideBar-memu-open"><i class="fa fa-navicon"></i></a>
      <ul class="sideBar-list">
        <li><a href="#"><i class="fa fa-home"></i><span class="padding-left">主页</span></a></li>
        <li><a href="#"><i class="fa fa-edit"></i><span class="padding-left">发文流程</span></a></li>
        <li><a href="#"><i class="fa fa-paste"></i><span class="padding-left">草稿箱</span></a></li>
        <li><a href="#"><i class="fa fa-sign-out"></i><span class="padding-left">出入库管理</span></a></li>
        <li><a href="#"><i class="fa fa-shield"></i><span class="padding-left">安全追溯</span></a></li>
        <li><a href="#"><i class="fa fa-tty"></i><span class="padding-left">储备粮油管理</span></a></li>
        <li><a href="#"><i class="fa fa-list-alt"></i><span class="padding-left">仓内粮情</span></a></li>
        <li><a href="#"><i class="fa fa-lock"></i><span class="padding-left">库区安全</span></a></li>
        <li><a href="#"><i class="fa fa-building"></i><span class="padding-left">市场粮情录入</span></a></li>
        <li><a href="#"><i class="fa fa-eye"></i><span class="padding-left">市场粮情监控</span></a></li>
        <li><a href="#"><i class="fa fa-bar-chart-o"></i><span class="padding-left">市场粮情分析</span></a></li>
        <li class="houbu" style="display: none;"><a href="../emerg/emerg.html"><i class="fa fa-shirtsinbulk"></i><span class="padding-left">应急指挥</span></a></li>
      </ul>
    </div>
  </div>
<!--sideBar end-->   
<!--right begin-->
    <div class="right-warp">
       <!--search begin-->
       <div class="search">
            <div class="pull-left ml25"> <i class="search-i fa fa-search"></i>
               <input class="inp-search" type="text" placeholder="搜索APP" />
             </div>
            <div class="pull-right mr30"> 
               <a href="#" class="icon-list"><i class="fa fa-th font18 mt7"></i></a>
               <a href="#" class="icon-set"><i class="fa fa-cog font20"></i></a>
               <a href="#" class="icon-ask"><i class="fa fa-question font22"></i></a>  
             </div>
       </div>
       <!--search end--> 
          
       <!--main begin-->
       <div class="main">
       
       <div class="crumbs">
              <p>
                  <i class="fa fa-home"></i> 粮油质量检测  > <span class="active ml5">检测标准及方法管理 </span>
              </p>
              <div class="crumbs-line"></div>
          </div> 

          <div class="content">
              <div class="right-cot w100">
                  <div class="crumbs">
                      <p>
                          <span class="active ml5"><i class="fa fa-user"></i>  检测标准及方法管理 </span>
                      </p>
                      <div class="crumbs-line"></div>
                  </div>
                  <div class="right-form">
                      <form action="" class="form-inline">
                          <div class="form-group">
                          <label for="address">检测产品类型:</label>
						<select id="testType" class="form-control-select">
										<option value="">请选择</option>
										<c:forEach items="${map}" var="m">
										<c:choose>
										<c:when test="${m.key eq testType}">
											<option selected="selected" value="${m.key}">${m.value}</option>
										</c:when>
										
										<c:otherwise>
										<option value="${m.key}">${m.value}</option>
										</c:otherwise>
										</c:choose>
										
										
										</c:forEach>
						</select>
                          </div>


                          <div class="form-right">
                              <button type="button" class="btn btn-orange" onclick="querySM()"><i class="fa fa-search"></i> 查 询</button>
                              <!-- <a href="#" class="set-up ml10">高级查询</a> -->
                          </div>
                      </form>
                  </div>
                  <div class="table-scroll">
                  
                  <div class="form-top">
                        <div class="mb10">
 							<button class="btn btn-default" onclick="goUpdate()"><i class="fa fa-plus"></i> 新 增</button>
                        </div>
                  </div>
                 
                      <table class="table-form table-bordered">
                          <thead>
                              <tr>
                                  <th>序号</th>
								  <th>检测产品类型</th>
								  <th>检测产品名称</th>
								  <th>检测项目名称</th>
								  <th>检测标准（方法）名称及编号（含年号）</th>
								  <th>检测标准（范围）</th>
								  <th>说明</th>
								  <th>操作</th>
                              </tr>
                          </thead>
                          <tbody>
                          <c:forEach items="${vo.data}" var="sm" varStatus="vs">
                          <tr>
                          <td>${vs.count+(page-1)*pageSize}</td>
                          <c:forEach items="${map }" var="m">
                          <c:if test="${m.key eq sm.testType }">
                           <td>${m.value}</td>
                          </c:if>
                          </c:forEach>
                         
                          <td>${sm.testName}</td>
                          <td>${sm.testProject}</td>
                          <td>${sm.testStandard}</td>
                          <td>${fn:replace(sm.testValue, '-','')}</td>
                          <td>${sm.remark}</td>
                          <td>
                           <a onclick="goUpdate('${sm.id}')" href="#" class="link-blue mr5"><i class="fa fa-pencil"></i>修改</a>
                           <a onclick="deleteByIds('${sm.id}')" href="#" class="link-blue mr5"><i class="fa fa-close"></i>删除</a>
                          </td>
                          </tr>
                          </c:forEach>                        
                          </tbody>
                      </table>
                  </div>

                  <div class="pages">
                    <div class="dataTables-length" >
                        <label>每页记录
                            <select aria-controls="dynamic-table" class="form-page" onchange="changePage('',$(this).val())">
                                <option <c:if test="${pageSize eq 10}">selected='selected'</c:if> value="10">10</option>
                                <option <c:if test="${pageSize eq 25}">selected='selected'</c:if> value="25">25</option>
                                <option <c:if test="${pageSize eq 50}">selected='selected'</c:if> value="50">50</option>
                                <option <c:if test="${pageSize eq 100}">selected='selected'</c:if> value="100">100</option>
                            </select>
                            <span class="ml5">共${pageCount}条记录</span>
                        </label>
                    </div>
                    <div class="dataTables-paginate pull-right">
                        <ul class="pagination-user">
                            <li onclick="changePage('1')"><a href="#">首页</a></li>
                            <li onclick="changePage('${page-1}')"><a href="#">上一页</a></li>
                            <li><label class="pull-left"><input id="shouldChangePage" type="text" value="${page}" class="inp-number">&nbsp;/${pageSum }&nbsp;</label></li>
                            <li><button onclick="changePage($('#shouldChangePage').val())" class="pull-right btn-fresh mr5">跳转</button></li>
                            <li onclick="changePage('${page+1}')"><a href="#">下一页</a></li>
                            <li onclick="changePage('${pageSum}')"><a href="#">尾页</a></li>
                        </ul>
                    </div>
                </div>
                
                <div class="block20"></div> 
                
              </div>
          <!--main end--> 
      </div>
       
       
       </div>
       <!--main end--> 
    </div>
</div>        
</body>
<script type="text/javascript">
function deleteByIds(id){
	layer.msg('是否继续执行操作？', {
  	    time: 0 //不自动关闭
  	    ,btn: ['确定', '取消']
  	    ,yes: function(index){
  	    	$.post("/standardmethod/deleteByIds",{ids:id},function(result){
  	  		if(result=="success"){
  	  			 layer.msg('操作成功', {
  	     	            icon: 1
  	     	        });
  	  		 	setInterval("window.location.href='/standardmethod/index'",2000);
  	  			
  	  		}else{
  	  			layer.msg('未知错误', {
  	     	            icon: 2
  	     	        });
  	  		}
  	  	});
  	    }
  	});
	
}

function querySM(){
	var testType=$("#testType").val();
	var url="/standardmethod/index?";
	
	if(testType!=""){
		url=url+"testType="+testType;
	}
	window.location.href=url;
}

function changePage(page,pageSize){
	var str="?";
	var pageSum=${pageSum};
	if(typeof(page)!="undefined"&&page!=""){
		str=str+"page="+page;
		if(page<1||page>pageSum){
			layer.msg('页数超出范围', {
		            icon: 0
		        });
			return;
		}
	}
	
	if(typeof(pageSize)!="undefined"){
		str=str+"pageSize="+pageSize;
	}
	window.location.href="/standardmethod/index"+str;
}

/* //页面必须实现acceptValue来接收回传参数
function acceptValue(value){
	id = value.split("/")[0];
	name = value.split("/")[1];
	$('#userId').val(id);
	$('#userName').val(name);
} */

function goUpdate(id){
	var str="?";
	if(typeof(id)!="undefined"){
		str=str+"id="+id;
	}
	layer.open({
	    type: 2,
	    title: '检测方法及标准',
	    maxmin: false,
	    shadeClose: false, //点击遮罩关闭层
	    area : ['800px' , '550px'],
	    content: '/standardmethod/edit'+str
	});
}

</script>
</html>